<!-- text按钮 -->
<template>
  <div>
    <ViewImageList
      v-if="isPreview"
      :errorMsg="errorMsg"
      :isIcon="isIcon"
      :echoFile="fileList"
      isViewBtn
    />
    <div class="item-img" v-else>
      <img :src="img1" v-if="isImg" />
      <BtnText type="primary" @BtnClick="viewImg">查看</BtnText>
    </div>
  </div>
</template>

<script type="text/javascript">
import img1 from "@/styles/images/icon1.png";
import ViewImageList from "../uploadDrag/viewImageList.vue";
export default {
  name: "view-img",
  components: {
    ViewImageList,
  },
  props: {
    errorMsg: {
      type: String,
      default: "",
    },
    isIcon: {
      type: Boolean,
      default: false,
    },
    isPreview: {
      type: Boolean,
      default: false,
    },
    fileList: {
      type: Array,
      default: () => [],
    },
    isImg: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {
      img1,
    };
  },
  methods: {
    viewImg() {
      this.$emit("BtnClick");
    },
  },
};
</script>

<style lang="less" scoped>
.item-img {
  display: flex;
  align-items: center;
  height: 20px;
  img {
    display: block;
    height: 15px;
    margin-right: 5px;
  }
}
::v-deep .btn-text-main {
  padding: 0 !important;
}
</style>
